Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(salesforcedx-vscode): update node to v16 and switch from npm to yarn #4042

Closed
wants to merge 67 commits into from

Conversation

mohanraj-r
Copy link
Contributor

@mohanraj-r mohanraj-r commented Apr 19, 2022

What does this PR do?

What issues does this PR fix or reference?

@W-11004197@

Functionality Before

  • Node v14 was used with older lockfile format

Functionality After

  • Node v16 used with yarn npm v8 and lockfile format v3

Notes

  • Run npm run reinstall after merge (remind team in slack)

Summary

Solutions

PNPM

Pros

  • Built-in phantom dep, peer dep checks
  • Built-in support for mono-repo
    • Handles dep locks for all packages in the mono-repo
  • Almost drop-in replacement for npm commands
    • supports node_modules by default unlike latest yarn
  • Closest drop-in replacement for lerna with similar commands (run, exec) and options (concurrency, filtering/scope)
    • bootstraps the mono-repo packages
  • Easier to read output / mental model
  • Lock file doesn't get updated implicitly on each install
  • Faster than npm, yarn

TODO

Packaging vsix fix
Build fix
Refactor
  • Migrate npm commands
  • Update dev docs
  • remove lerna bootstrap?
    • fix called twice
  • re-eval added @tsignore
  • npmrc -> yarnrc
  • refactor clean and reinstall script
Document / share
Explore

@mohanraj-r mohanraj-r requested a review from a team as a code owner April 19, 2022 18:13
Copy link
Contributor

@gbockus-sf gbockus-sf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool looks good 👍 Any ideas on why the circle build is failing? The error looks familiar but I don't remember the details of what results in that error.

npm WARN config production Use `--omit=dev` instead.
 ERROR  Command failed: npm list --production --parseable --depth=99999 --loglevel=error

Think we need to update the packing script to account for the above warning?

@mohanraj-r
Copy link
Contributor Author

mohanraj-r commented Apr 26, 2022

vsce package doesn't work with npm 8 or 7 (microsoft/vscode-vsce#580, microsoft/vscode-vsce#439, microsoft/vscode-vsce#673, lerna/lerna#2822) even on node 14.
Also tried

  • with and without npm workspaces
  • updating vsce to latest version (2.x).
lerna ERR! npm run vscode:package stderr:
npm WARN config production Use `--omit=dev` instead.
 ERROR  Command failed: npm list --production --parseable --depth=99999 --loglevel=error
npm ERR! code ELSPROBLEMS
npm ERR! missing: @salesforce/[email protected], required by salesforcedx-apex-debugger@npm:@salesforce/[email protected]
npm ERR! missing: @types/[email protected], required by salesforcedx-apex-debugger@npm:@salesforce/[email protected]
npm ERR! missing: @types/[email protected], required by salesforcedx-apex-debugger@npm:@salesforce/[email protected]
npm ERR! missing: @types/mocha@^5, required by salesforcedx-apex-debugger@npm:@salesforce/[email protected]
npm ERR! missing: @types/[email protected], required by salesforcedx-apex-debugger@npm:@salesforce/[email protected]
npm ERR! missing: @types/rimraf@^2.0.2, required by salesforcedx-apex-debugger@npm:@salesforce/[email protected]
npm ERR! missing: @types/sinon@^2.3.7, required by salesforcedx-apex-debugger@npm:@salesforce/[email protected]
npm ERR! missing: chai@^4.0.2, required by salesforcedx-apex-debugger@npm:@salesforce/[email protected]
npm ERR! missing: [email protected], required by salesforcedx-apex-debugger@npm:@salesforce/[email protected]
npm ERR! missing: mocha-junit-reporter@^1.23.3, required by salesforcedx-apex-debugger@npm:@salesforce/[email protected]
npm ERR! missing: mocha-multi-reporters@^1.1.7, required by salesforcedx-apex-debugger@npm:@salesforce/[email protected]
npm ERR! missing: mocha@^5, required by salesforcedx-apex-debugger@npm:@salesforce/[email protected]
npm ERR! missing: [email protected], required by salesforcedx-apex-debugger@npm:@salesforce/[email protected]
npm ERR! missing: nyc@^13, required by salesforcedx-apex-debugger@npm:@salesforce/[email protected]
npm ERR! missing: [email protected], required by salesforcedx-apex-debugger@npm:@salesforce/[email protected]
npm ERR! missing: sinon@^13.0.1, required by salesforcedx-apex-debugger@npm:@salesforce/[email protected]
npm ERR! missing: [email protected], required by salesforcedx-apex-debugger@npm:@salesforce/[email protected]
npm ERR! missing: [email protected], required by salesforcedx-apex-debugger@npm:@salesforce/[email protected]
npm ERR! missing: @salesforce/[email protected], required by salesforcedx-utils-vscode@npm:@salesforce/[email protected]
npm ERR! missing: @types/[email protected], required by salesforcedx-utils-vscode@npm:@salesforce/[email protected]
npm ERR! missing: @types/[email protected], required by salesforcedx-utils-vscode@npm:@salesforce/[email protected]
npm ERR! missing: @types/[email protected], required by salesforcedx-utils-vscode@npm:@salesforce/[email protected]
npm ERR! missing: @types/mocha@^5, required by salesforcedx-utils-vscode@npm:@salesforce/[email protected]
npm ERR! missing: @types/[email protected], required by salesforcedx-utils-vscode@npm:@salesforce/[email protected]
npm ERR! missing: @types/[email protected], required by salesforcedx-utils-vscode@npm:@salesforce/[email protected]
npm ERR! missing: @types/sinon@^2.3.7, required by salesforcedx-utils-vscode@npm:@salesforce/[email protected]
npm ERR! missing: @types/[email protected], required by salesforcedx-utils-vscode@npm:@salesforce/[email protected]
npm ERR! missing: chai@^4.0.2, required by salesforcedx-utils-vscode@npm:@salesforce/[email protected]
npm ERR! missing: mocha-junit-reporter@^1.23.3, required by salesforcedx-utils-vscode@npm:@salesforce/[email protected]
npm ERR! missing: mocha-multi-reporters@^1.1.7, required by salesforcedx-utils-vscode@npm:@salesforce/[email protected]
npm ERR! missing: mocha@^5, required by salesforcedx-utils-vscode@npm:@salesforce/[email protected]
npm ERR! missing: [email protected], required by salesforcedx-utils-vscode@npm:@salesforce/[email protected]
npm ERR! missing: nyc@^13, required by salesforcedx-utils-vscode@npm:@salesforce/[email protected]
npm ERR! missing: [email protected], required by salesforcedx-utils-vscode@npm:@salesforce/[email protected]
npm ERR! missing: [email protected], required by salesforcedx-utils-vscode@npm:@salesforce/[email protected]
npm ERR! missing: sinon@^13.0.1, required by salesforcedx-utils-vscode@npm:@salesforce/[email protected]
npm ERR! missing: [email protected], required by salesforcedx-utils-vscode@npm:@salesforce/[email protected]

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/circleci/.npm/_logs/2022-04-19T18_36_10_092Z-debug-0.log

@mohanraj-r
Copy link
Contributor Author

mohanraj-r commented Apr 27, 2022

Bundle size / validity

Baseline (vsce + npm prune)

To compare with baseline, the vsix files buit with vsce & npm (from develop@ 6782d42)

 DONE  Packaged: salesforcedx-vscode/packages/salesforcedx-vscode-apex-debugger/salesforcedx-vscode-apex-debugger-54.11.0.vsix (605 files, 1.24MB)
 DONE  Packaged: salesforcedx-vscode/packages/salesforcedx-vscode-apex-replay-debugger/salesforcedx-vscode-apex-replay-debugger-54.11.0.vsix (4830 files, 6.93MB)
 DONE  Packaged: salesforcedx-vscode/packages/salesforcedx-vscode-apex/salesforcedx-vscode-apex-54.11.0.vsix (5193 files, 22.06MB)
 DONE  Packaged: salesforcedx-vscode/packages/salesforcedx-vscode-core/salesforcedx-vscode-core-54.11.0.vsix (16070 files, 24.6MB)
 DONE  Packaged: salesforcedx-vscode/packages/salesforcedx-vscode-expanded/salesforcedx-vscode-expanded-54.11.0.vsix (6 files, 12.04KB)
 DONE  Packaged: salesforcedx-vscode/packages/salesforcedx-vscode-lightning/salesforcedx-vscode-lightning-54.11.0.vsix (5524 files, 8.6MB)
 DONE  Packaged: salesforcedx-vscode/packages/salesforcedx-vscode-lwc/salesforcedx-vscode-lwc-54.11.0.vsix (20187 files, 30.9MB)
 DONE  Packaged: salesforcedx-vscode/packages/salesforcedx-vscode-soql/salesforcedx-vscode-soql-54.11.0.vsix (3231 files, 4.84MB)
 DONE  Packaged: salesforcedx-vscode/packages/salesforcedx-vscode-visualforce/salesforcedx-vscode-visualforce-54.11.0.vsix (757 files, 3.22MB)
 DONE  Packaged: salesforcedx-vscode/packages/salesforcedx-vscode/salesforcedx-vscode-54.11.0.vsix (7 files, 21.57KB)

Yarn

vsce packaging seems to work with yarn (without any patches) - but the vsix bundle sizes are significantly lower than those produced with npm. Quick smoke test with the vsix files shows errors and extensions not working as intended.

8:scode-apex-debugger/salesforcedx-vscode-apex-debugger-54.10.0.vsix (28 files, 48.31KB)
13:scode-apex-replay-debugger/salesforcedx-vscode-apex-replay-debugger-54.10.0.vsix (52 file
18:scode-apex/salesforcedx-vscode-apex-54.10.0.vsix (109 files, 14.85MB)
22: DONE  Packaged: salesforcedx-vscode/packages/salesforcedx-vscode-core/salesforcedx-vscode-core-54.10.0.vsix (295 files, 373.02KB)
25: DONE  Packaged: salesforcedx-vscode/packages/salesforcedx-vscode-expanded/salesforcedx-vscode-expanded-54.10.0.vsix (6 files, 12.03KB)
28: DONE  Packaged: salesforcedx-vscode/packages/salesforcedx-vscode-lightning/salesforcedx-vscode-lightning-54.10.0.vsix (19 files, 55.78KB)
31: DONE  Packaged: salesforcedx-vscode/packages/salesforcedx-vscode-lwc/salesforcedx-vscode-lwc-54.10.0.vsix (131 files, 166.16KB)
34: DONE  Packaged: salesforcedx-vscode/packages/salesforcedx-vscode-soql/salesforcedx-vscode-soql-54.10.0.vsix (9 files, 402.21KB)
37: DONE  Packaged: salesforcedx-vscode/packages/salesforcedx-vscode-visualforce/salesforcedx-vscode-visualforce-54.10.0.vsix (22 files, 45.4KB)
40: DONE  Packaged: salesforcedx-vscode/packages/salesforcedx-vscode/salesforcedx-vscode-54.10.0.vsix (7 files, 21.48KB)

With esbuild


 DONE  Packaged: salesforcedx-vscode/packages/salesforcedx-vscode-apex-debugger/salesforcedx-vscode-apex-debugger-54.11.0.vsix (28 files, 61.62KB)
 DONE  Packaged: salesforcedx-vscode/packages/salesforcedx-vscode-apex-replay-debugger/salesforcedx-vscode-apex-replay-debugger-54.11.0.vsix (52 files, 1.23MB)
 DONE  Packaged: salesforcedx-vscode/packages/salesforcedx-vscode-apex/salesforcedx-vscode-apex-54.11.0.vsix (109 files, 16.15MB)
 DONE  Packaged: salesforcedx-vscode/packages/salesforcedx-vscode-core/salesforcedx-vscode-core-54.11.0.vsix (295 files, 3.69MB)
 DONE  Packaged: salesforcedx-vscode/packages/salesforcedx-vscode-expanded/salesforcedx-vscode-expanded-54.11.0.vsix (6 files, 12.05KB)
 DONE  Packaged: salesforcedx-vscode/packages/salesforcedx-vscode-lightning/salesforcedx-vscode-lightning-54.11.0.vsix (19 files, 801.67KB)
 DONE  Packaged: salesforcedx-vscode/packages/salesforcedx-vscode-lwc/salesforcedx-vscode-lwc-54.11.0.vsix (131 files, 1.22MB)
 DONE  Packaged: salesforcedx-vscode/packages/salesforcedx-vscode-soql/salesforcedx-vscode-soql-54.11.0.vsix (9 files, 391.29KB)
 DONE  Packaged: salesforcedx-vscode/packages/salesforcedx-vscode-visualforce/salesforcedx-vscode-visualforce-54.11.0.vsix (22 files, 73.99KB)
 DONE  Packaged: salesforcedx-vscode/packages/salesforcedx-vscode/salesforcedx-vscode-54.11.0.vsix (7 files, 21.58KB)

Update vsce

Using latest vsce version 2.7.0 (or 2.6.1) results in error from package that doesn't need to be packaged - microsoft/vscode-vsce#675

$ lerna run vscode:package --concurrency 1 && node scripts/reformat-with-prettier
lerna notice cli v3.22.1
lerna info Executing command in 10 packages: "yarn run vscode:package"
lerna ERR! yarn run vscode:package exited 1 in 'salesforcedx-vscode-apex-debugger'
lerna ERR! yarn run vscode:package stdout:
$ vsce package --yarn
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

lerna ERR! yarn run vscode:package stderr:
 ERROR  Extension entrypoint(s) missing. Make sure these files exist and aren't ignored by '.vscodeignore':
  extension/out/src.js
error Command failed with exit code 1.

lerna ERR! yarn run vscode:package exited 1 in 'salesforcedx-vscode-apex-debugger'
lerna WARN complete Waiting for 1 child process to exit. CTRL-C to exit immediately.
error Command failed with exit code 1.

Other potential solutions

@mohanraj-r mohanraj-r changed the title build(salesforcedx-vscode): update node to v16 and npm to v8 build(salesforcedx-vscode): update node to v16 and switch from npm to yarn Apr 28, 2022
mohanraj-r added 23 commits May 3, 2022 14:02
as it has issues with the tsconfig used by tsc build with project ref
@mohanraj-r mohanraj-r force-pushed the mohanraj-r/node16_npm8_update branch from b892421 to d96e324 Compare May 3, 2022 21:17
@mohanraj-r
Copy link
Contributor Author

Broken up into smaller PRs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants